import request from '@/utils/request'

// api地址
const api = {
    login: 'passport/login',
    loginMpWx: 'passport/loginMpWx',
    loginMpWxMobile: 'passport/loginMpWxMobile',
    loginWxH5: 'wechat/authUrl',
    getWxCode: 'wechat/authCallback',
    getSubscribe: 'wechat/isSubscribed',
    getVisitbook : 'visit/book'
}

// 用户登录(手机号+验证码)
export function login(data) {
    return request.post(api.login, data)
}

// 微信小程序快捷登录(获取微信用户基本信息)
export function loginMpWx(data, option) {
    return request.post(api.loginMpWx, data, option)
}

// 微信小程序快捷登录(授权手机号)
export function loginMpWxMobile(data, option) {
    return request.post(api.loginMpWxMobile, data, option)
}

//微信H5登录
export function loginWxH5(data, option) {
    return request.post(api.loginWxH5, data, option)
}

// 微信code
export function getWxCode(data) {
    return request.get(api.getWxCode, data)
}

//轮询是否已关注过企业微信
export function isSubscribed(data) {
    return request.get(api.getSubscribe, data, { load: false })
}

//微信H5登录
export function getVisitbook(data, option) {
    return request.get(api.getVisitbook, data)
}